package kr.hkit.androidcomplete01.ch17;

import java.io.File;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

public class CallOther extends Activity {
	Intent intent;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch17_callother);
	}
	
	public void mOnClick(View v){
		switch(v.getId()){
		case R.id.web:
			intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
			break;
		case R.id.dial:
			intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:015-123-4567"));
			break;
		case R.id.picture:
			intent = new Intent(Intent.ACTION_VIEW);
			String sd = Environment.getExternalStorageDirectory().getAbsolutePath();
			Log.d("CallOther", "외부 저장 경로" + sd);
			Uri uri = Uri.fromFile(new File(sd + "/kim3.jpg"));
			intent.setDataAndType(uri, "image/jpeg");
			break;
		case R.id.other:
			intent = new Intent(Intent.ACTION_MAIN);
			intent.setComponent(new ComponentName("exam.memo", "exam.memo.Memo"));
			break;
		}
		startActivity(intent);
	}
}
